/**
 */
package org.mro.grib.model.files.secondEdition.sections.impl;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

import org.mro.grib.model.files.secondEdition.sections.*;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class SectionsFactoryImpl extends EFactoryImpl implements SectionsFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static SectionsFactory init() {
		try {
			SectionsFactory theSectionsFactory = (SectionsFactory)EPackage.Registry.INSTANCE.getEFactory(SectionsPackage.eNS_URI);
			if (theSectionsFactory != null) {
				return theSectionsFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new SectionsFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SectionsFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case SectionsPackage.INDICATOR_SECTION: return createIndicatorSection();
			case SectionsPackage.IDENTIFICATION_SECTION: return createIdentificationSection();
			case SectionsPackage.LOCAL_USE_SECTION: return createLocalUseSection();
			case SectionsPackage.GRID_DEFINITION_SECTION: return createGridDefinitionSection();
			case SectionsPackage.PRODUCT_DEFINITION_SECTION: return createProductDefinitionSection();
			case SectionsPackage.DATA_REPRESENTATION_SECTION: return createDataRepresentationSection();
			case SectionsPackage.BIT_MAP_SECTION: return createBitMapSection();
			case SectionsPackage.DATA_SECTION: return createDataSection();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case SectionsPackage.DISCIPLINE:
				return createDisciplineFromString(eDataType, initialValue);
			case SectionsPackage.MASTER_TABLE_VERSION_NUMBER:
				return createMasterTableVersionNumberFromString(eDataType, initialValue);
			case SectionsPackage.SIGNIFICANCE_OF_REFERENCE_TIME:
				return createSignificanceOfReferenceTimeFromString(eDataType, initialValue);
			case SectionsPackage.PRODUCTION_STATUS_OF_DATA:
				return createProductionStatusOfDataFromString(eDataType, initialValue);
			case SectionsPackage.TYPE_OF_DATA:
				return createTypeOfDataFromString(eDataType, initialValue);
			case SectionsPackage.IDENTIFICATION_TEMPLATE_NUMBER:
				return createIdentificationTemplateNumberFromString(eDataType, initialValue);
			case SectionsPackage.TYPE_OF_CALENDAR:
				return createTypeOfCalendarFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case SectionsPackage.DISCIPLINE:
				return convertDisciplineToString(eDataType, instanceValue);
			case SectionsPackage.MASTER_TABLE_VERSION_NUMBER:
				return convertMasterTableVersionNumberToString(eDataType, instanceValue);
			case SectionsPackage.SIGNIFICANCE_OF_REFERENCE_TIME:
				return convertSignificanceOfReferenceTimeToString(eDataType, instanceValue);
			case SectionsPackage.PRODUCTION_STATUS_OF_DATA:
				return convertProductionStatusOfDataToString(eDataType, instanceValue);
			case SectionsPackage.TYPE_OF_DATA:
				return convertTypeOfDataToString(eDataType, instanceValue);
			case SectionsPackage.IDENTIFICATION_TEMPLATE_NUMBER:
				return convertIdentificationTemplateNumberToString(eDataType, instanceValue);
			case SectionsPackage.TYPE_OF_CALENDAR:
				return convertTypeOfCalendarToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IndicatorSection createIndicatorSection() {
		IndicatorSectionImpl indicatorSection = new IndicatorSectionImpl();
		return indicatorSection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IdentificationSection createIdentificationSection() {
		IdentificationSectionImpl identificationSection = new IdentificationSectionImpl();
		return identificationSection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LocalUseSection createLocalUseSection() {
		LocalUseSectionImpl localUseSection = new LocalUseSectionImpl();
		return localUseSection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public GridDefinitionSection createGridDefinitionSection() {
		GridDefinitionSectionImpl gridDefinitionSection = new GridDefinitionSectionImpl();
		return gridDefinitionSection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ProductDefinitionSection createProductDefinitionSection() {
		ProductDefinitionSectionImpl productDefinitionSection = new ProductDefinitionSectionImpl();
		return productDefinitionSection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DataRepresentationSection createDataRepresentationSection() {
		DataRepresentationSectionImpl dataRepresentationSection = new DataRepresentationSectionImpl();
		return dataRepresentationSection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BitMapSection createBitMapSection() {
		BitMapSectionImpl bitMapSection = new BitMapSectionImpl();
		return bitMapSection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DataSection createDataSection() {
		DataSectionImpl dataSection = new DataSectionImpl();
		return dataSection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Discipline createDisciplineFromString(EDataType eDataType, String initialValue) {
		Discipline result = Discipline.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertDisciplineToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MasterTableVersionNumber createMasterTableVersionNumberFromString(EDataType eDataType, String initialValue) {
		MasterTableVersionNumber result = MasterTableVersionNumber.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertMasterTableVersionNumberToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SignificanceOfReferenceTime createSignificanceOfReferenceTimeFromString(EDataType eDataType, String initialValue) {
		SignificanceOfReferenceTime result = SignificanceOfReferenceTime.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertSignificanceOfReferenceTimeToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ProductionStatusOfData createProductionStatusOfDataFromString(EDataType eDataType, String initialValue) {
		ProductionStatusOfData result = ProductionStatusOfData.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertProductionStatusOfDataToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TypeOfData createTypeOfDataFromString(EDataType eDataType, String initialValue) {
		TypeOfData result = TypeOfData.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertTypeOfDataToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IdentificationTemplateNumber createIdentificationTemplateNumberFromString(EDataType eDataType, String initialValue) {
		IdentificationTemplateNumber result = IdentificationTemplateNumber.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertIdentificationTemplateNumberToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TypeOfCalendar createTypeOfCalendarFromString(EDataType eDataType, String initialValue) {
		TypeOfCalendar result = TypeOfCalendar.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertTypeOfCalendarToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SectionsPackage getSectionsPackage() {
		return (SectionsPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static SectionsPackage getPackage() {
		return SectionsPackage.eINSTANCE;
	}

} //SectionsFactoryImpl
